﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;

namespace Vibz.Common.Channel
{
    public class Network
    {
        public static string GetIp()
        {
            return Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork).ToString();
        }
        public static void SendMessageToClient(System.Net.Sockets.Socket socket, string message)
        {
            var messageBytes =
                  System.Text.Encoding.ASCII.GetBytes(message);
            SendMessageToClient(socket, messageBytes);
        }
        public static void SendMessageToClient(System.Net.Sockets.Socket socket, byte[] messageBytes)
        {
            socket.Send(messageBytes);
        }
    }
}
